{extend name="$LAYOUT_HOME_BASE" /}
{block name="title"}团购商品 -{:WSTConf('CONF.mallName')}{__block__}{/block}
{block name="meta"}
<meta name="description" content="{:WSTConf('CONF.seoGrouponDesc')}">
<meta name="Keywords" content="{:WSTConf('CONF.seoGrouponKeywords')}">
{/block}
{block name="css"}
<link href="__ROOT__/addons/groupon/view/home/index/css/carts.css?v={$v}" rel="stylesheet">
{/block}
{block name="top"}
  {include file="$LAYOUT_HOME_TOP" /}
{/block}
{block name="shop_apply"}
  {include file="$LAYOUT_HOME_SHOP_APPLY" /}
{/block}
{block name="header"}
  {include file="$LAYOUT_HOME_HEADER" /}
{/block}
{block name="main"}
<div class="wst-container">
	<div id="stepflex" class="stepflex">
       <dl class="first doing">
          <dt class="s-num">1</dt>
          <dd class="s-text">我的购物车</dd>
          <dd></dd>
       </dl>
       <dl class="normal doing">
          <dt class="s-num">2</dt>
          <dd class="s-text">填写核对订单信息</dd>
       </dl>
       <dl class="last">
          <dt class="s-num1">3</dt>
          <dd class="s-text1">成功提交订单</dd>
       </dl>
    </div>
    <div class='wst-clear'></div>
    <div class='main-head'>填写并核对订单</div>
    
    <!-- 用户地址 -->
    {if $carts['goodsType']==0}
    <input type='hidden' class='j-ipt' id='s_addressId' value='{if isset($userAddress["addressId"]) }{$userAddress["addressId"]}{/if}'/>
    <input type='hidden' class='j-ipt' id='s_areaId' value='{if isset($userAddress["addressId"]) }{$userAddress["areaId2"]}{/if}'/>
    <div class='address-box'>
       <div class='box-head'>收货人信息 <a class="add-addr" href="javascript:;" onclick="javascript:emptyAddress(this,1)">新增收货地址</a></div>
       <!-- 选中地址 -->
       <div class='j-show-box {if empty($userAddress)}hide{/if}' >
          <div id="s_userName" class="wst-frame1 j-selected">{if isset($userAddress["addressId"]) }{$userAddress['userName']}{/if}<i></i></div>
          <div class="address" onmouseover="addrBoxOver(this)" onmouseout="addrBoxOut(this)">
            <span id='s_address'>
            {if isset($userAddress["addressId"]) }
            {$userAddress['userName']}&nbsp;&nbsp;&nbsp;{$userAddress['areaName']}&nbsp;&nbsp;{$userAddress['userAddress']}&nbsp;&nbsp;{$userAddress['userPhone']}
            {/if}
            </span>
            &nbsp;&nbsp;
            <span id="isdefault" {if(isset($userAddress['isDefault'])&&($userAddress['isDefault']==1))} class="j-default">默认地址{else /} >{/if}</span>
            <div class="operate-box">
              <a href="javascript:void(0)" onclick="javascript:toEditAddress({if isset($userAddress["addressId"]) }{$userAddress["addressId"]}{/if},this,1,1,1)">编辑</a>&nbsp;&nbsp;
            </div>
          </div>
                    
          <div class='wst-clear'></div>

          <div class="address">
            <a class="wst-lfloat" href='javascript:void(0)' onclick='javascript:showEditAddressBox()' style=''>更多地址</a>
          </div>

       </div>
       <!-- 地址列表  -->
       <ul class='j-list-box hide' id='addressList'></ul>
       <!-- 新增编辑地址 -->
       <div class='j-edit-box {if !empty($userAddress)}hide{/if}'>
          <form id='addressForm' autocomplete='off'>
            <input type='hidden' class='j-eipt' id='addressId' value=''/>
            <div class='rows'>
                <div class='label'>收货人<font color='red'>*</font>：</div>
                <div class='field'><input type='text' class='j-eipt' id='userName' maxLength='25'/></div>
                <div class='wst-clear'></div>
            </div>
            <div class='rows'>
                <div class='label'>收货地址<font color='red'>*</font>：</div>
                <div class='field'>
                <select id="area_0" class='j-areas' level="0" onchange="WST.ITAreas({id:'area_0',val:this.value,isRequire:true,className:'j-areas'});">
              <option value="">-请选择-</option>
              {volist name="areaList" id="vo"}
              <option value="{$vo['areaId']}">{$vo['areaName']}</option>
              {/volist}
          </select>
                <input type='text' class='j-eipt' id='userAddress' style='width:300px' maxLength='200'/>
                </div>
                <div class='wst-clear'></div>
            </div>
            <div class='rows'>
                <div class='label'>联系电话<font color='red'>*</font>：</div>
                <div class='field'><input type='text' id='userPhone' class='j-eipt' name="addrUserPhone" maxLength='50'/>  </div>
                <div class='wst-clear'></div>
            </div>
            <div class='rows'>
                <div class='label'>是否默认地址<font color='red'>*</font>：</div>
                <div class='radio-box'>
                  <label style='margin-right:36px;'>
                     <input type='radio' name='isDefault' value='1' checked class='j-eipt wst-radio' id="isDefault1"/><label class="mt-1" for="isDefault1"></label>是
                  </label>
                  <label>
                     <input type='radio' name='isDefault' value='0' class='j-eipt wst-radio' id="isDefault2"/><label class="mt-1" for="isDefault2"></label>否
                  </label>
                </div>
                <div class='wst-clear'></div>
            </div>
            <div class='rows'>
                <a href='javascript:void(0)' class='wst-cart-reda' id='saveAddressBtn' onclick='javascript:editAddress()' style='width:105px;line-height:33px;padding:6px 15px'>保存收货人地址</a>
            </div>
          </form>
       </div>
    </div>
    {/if}
    <!-- 支付方式 -->
    <div class='pay-box' style='border-top:2px solid #fc7a64'>
       <div class='box-head'>支付方式</div>
       <div class="wst-list-box">
          {if !empty($payments['0'])} 
          <div class="wst-frame2 j-selected" onclick="javascript:changeSelected(0,'payType',this)">货到付款<i></i></div>
          {/if}
          {if !empty($payments['1'])}  
          <div class="wst-frame2 <?php echo empty($payments['0'])?'j-selected':''; ?>" onclick="javascript:changeSelected(1,'payType',this)">在线支付<i></i></div>
          {/if}
          <input type='hidden' value="<?php echo empty($payments['0'])?1:0; ?>" id='payType' class='j-ipt' />
          <div class='wst-clear'></div>
       </div>
    </div>
    {php}$shopFreight = 0;$freight = 0;{/php}
    {php}$cartShops = $carts["carts"];$cartGoods = $cartShops['goods'];{/php}
    {php}
       if($carts['goodsType']==0 && !$cartShops['isFreeShipping']){
         if(!empty($userAddress)){
             $freight = WSTOrderFreight($cartShops['shopId'],$userAddress['areaId2']);
             $shopFreight = $shopFreight + $freight;
         }else{
             $freight = 0;
             $shopFreight = $shopFreight + $freight;
         }
       }
    {/php}
    <!-- 商品清单 -->
    <div class='cart-box2'>
       <div class='box-head2'>商品清单</div>
       <div class='cart-head2'>
          <div class='goods2'>商品</div>
          <div class='price2'>单价</div>
          <div class='num2'>数量</div>
          <div class='t-price2'>总价</div>
       </div>
       <div class='cart-item'>
          <div class='shop2'>
          {$cartShops['shopName']}
          {if $cartShops['shopQQ'] !=''}
          <a href="tencent://message/?uin={$cartShops['shopQQ']}&Site=QQ交谈&Menu=yes">
			  <img border="0" src="http://wpa.qq.com/pa?p=1:{$cartShops['shopQQ']}:7" alt="QQ交谈" width="71" height="24"/>
		  </a>
          {/if}
          {if $cartShops['shopWangWang'] !=''}
          <a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid={$cartShops['shopWangWang']}&siteid=cntaobao&status=1&charset=utf-8">
			  <img border="0" src="http://amos.alicdn.com/realonline.aw?v=2&uid={$cartShops['shopWangWang']}&site=cntaobao&s=1&charset=utf-8" alt="和我联系" />
		  </a>
          {/if}
          </div>
          <div class='goods-list'>
             <div class='item selected'>
		        <div class='goods2'>
		            <div class='img2'>
		                <a href='{:Url("home/goods/detail","id=".$cartGoods["goodsId"])}' target='_blank'>
			            <img src='__RESOURCE_PATH__/{$cartGoods["goodsImg"]}' width='80' height='80' title='{$cartGoods["goodsName"]}'/>
			            </a>
		            </div>
		            <div class='name2'>{$cartGoods["goodsName"]}</div>
		            <div class='spec2'></div>
		        </div>
		        <div class='price2'>¥{$cartGoods['shopPrice']}</div>
		        <div class='num2'>{$cartGoods['cartNum']}</div>
		        <div class='t-price2'>¥{$cartGoods['shopPrice']*$cartGoods['cartNum']}</div>
		        <div class='wst-clear'></div>
             </div>
             <div class='shop-remark selected2'>
              订单备注：<input type='text' id="remark_{$cartShops['shopId']}" class='j-ipt' style='width:700px;' maxLength='100' placeholder='给卖家留言'/>

             <div style="float: right;margin-top:-10px;">
             <p style="text-align:right;padding-right:13px;{if $carts['goodsType']==1}display:none{/if}" >
              <span style="text-align: right;line-height: 30px;">运费：<span id="shopF_{$cartShops['shopId']}" style='font-weight: bold;color: #E55356;'>￥{$freight}</span></span>
            </p>
             <span style='text-align:right;line-height:30px;padding-right:13px;'>店铺合计{if $carts['goodsType']==0}(含运费){/if}：<span id="shopC_{$cartShops['shopId']}" v="{$cartShops['goodsMoney']}" style='font-weight: bold;color: #E55356;'>￥{$freight+$cartShops['goodsMoney']}</span></span>
             </div>

           </div>
          </div>
       </div>
       <!-- 送货方式 -->
    {if !empty($payments['0'])} 
    <div class='pay-boxs'>
       <div class='box-head'>送货方式</div>
       <div class="wst-list-box">
         <div class="wst-frame2 j-selected" onclick="javascript:changeDeliverType(0,'deliverType',this)">快递运输<i></i></div>
         <div class="wst-frame2" onclick="javascript:changeDeliverType(1,'deliverType',this)">自提<i></i></div>
          <input type='hidden' value='0' id='deliverType' class='j-ipt' />
          <div class='wst-clear'></div>
       </div>
    </div>
    {/if}
       <div class='cart-footer'>
          <div class='cart-summary2'>
          	<div class="summarys2">
    <!-- 发票信息 -->
    <div class="pay-boxs">
       <div class='box-head'>发票信息</div>
         <div class="j-show-box">

         <div style="float:left;" id="invoice_info">不开发票</div>
         <div style="float:left;color:blue;margin-left:10px;cursor:pointer;" onclick='javascript:changeInvoice(1,"#invoiceClientDiv",this)'>修改</div>

         <div class="wst-clear"></div>
         <input type="hidden" id="invoice_obj" value="0" />
           <input type="hidden" id="invoiceId" value="0" class='j-ipt' />
           <input type='hidden' value='0' id='isInvoice' class='j-ipt' />
           <input type='hidden' value='个人' id='invoiceClient' class='j-ipt' />
       </div>
       <div class='wst-clear'></div>
     </div>
          	</div>
          	<div class="summarys3" style='text-align:right;padding-right:20px'>
             {if WSTConf('CONF.isOpenScorePay')==1}
             <div>
             （共有{$userScore}个积分，可抵¥{:WSTScoreToMoney($userScore)}）
             <input type='checkbox' id='isUseScore' autocomplete="off" onclick='javascript:checkScoreBox(this.checked)' dataval="{$userScore}"/>积分支付
             <span id='scoreMoney' style='display:none'>
             ，使用积分<input type="text" id="useScore" style="width:50px;margin-left:5px" class='j-ipt' onkeyup="javascript:WST.isChinese(this,1)" autocomplete="off" onkeypress="return WST.isNumberKey(event)" onblur="javascript:getCartMoney()" value="{$userScore}"/>
             </span>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¥-<span id='scoreMoney2'>0.0</span></div>
             {/if}
             <div class='summary2'>应付总金额(含运费)：¥<span id='totalMoney' v='{$carts["goodsTotalMoney"]}'>
             {if empty($userAddress)}
             {$carts["goodsTotalMoney"]}
             {else}
             {$carts["goodsTotalMoney"]+$shopFreight}
             {/if}
             </span></div>
             <div {if WSTConf('CONF.isOrderScore')!=1 }style='display:none'{/if}>可获得积分：<span id='orderScore'>{:WSTMoneyGiftScore($carts["goodsTotalMoney"])}</span>个</div>
             </div>
             <div class='wst-clear'></div>
          </div>         
       </div>
    </div>
     <div class='cart-btn'>
        <a href='javascript:void(0)' onclick='javascript:submitOrder()' class='wst-order wst-cart-reda' style='width:118px;height:33px;line-height:33px;'>提交订单</a>
        <div class='wst-clear'></div>
     </div>
</div>
{/block}
{block name="footer"}
  {include file="$LAYOUT_HOME_FOOTER" /}
{/block}
{block name="js"}
<script type='text/javascript' src='__ROOT__/addons/groupon/view/home/index/js/carts.js?v={$v}'></script>
{/block}